import request from '@/router/axios';

// 获取采购计划列表
export const getPurchaseplanList = (current, size, params) => {
  return request({
    url: '/api/blade-purchase/purchaseplan/list',
    method: 'get',
    params: {
      ...params,
      current,
      size
    }
  })
}
// 删除
export const remove = (ids) => {
  return request({
    url: '/api/blade-purchase/purchaseplan/removeNew',
    method: 'post',
    params: {
      ids,
    }
  })
}

// 保存采购计划
export const savePurchasePlan = (data) => {
  return request({
    url: '/api/blade-purchase/purchaseplan/saveNew',
    method: 'post',
    data: data
  })
}

//查看&编辑
export const detail = (id) => {
  return request({
    url: '/api/blade-purchase/purchaseplan/detailNew',
    method: 'get',
    params: {
      id
    }
  })
}

// 获取采购员
export const getBuyerByMaterialGroupNo = (mateiralGroupNo) => {
  return request({
    url: '/api/blade-purchase/basic/getBuyerByMaterialGroupNo',
    method: 'get',
    params: {
      mateiralGroupNo,
    }
  })
}

// 获取物料列表
export const getmaterialList = (current, size, purchaseType, materialGroupNo,createUser) => {
  console.log(purchaseType)
  return request({
    url: '/api/blade-purchase/purchaseplan/listNew',
    method: 'get',
    params: {
      current,
      size,
      purchaseType,
      materialGroupNo,
      createUser
    }
  })
}
// 获取物料组
export const getMaterialGroupNoList = (userId) => {
  return request({
    url: '/api/blade-purchase/materialgroupinfo/materialGroupNoList',
    method: 'get',
    params: {
      userId
    }
  })
}
